Skip to content

Conversation

@oana-lolea
Copy link
Contributor

@oana-lolea oana-lolea commented Oct 22, 2025

Changes proposed in this pull request

  • Allow filtering incoming payments by initiatedBy

Context

Fixes #3648 | RAF-1165

Checklist

  • Related issues linked using fixes #number
  • Tests added/updated
  • Make sure that all checks pass
  • Bruno collection updated (if necessary)
  • Documentation issue created with user-docs label (if necessary)
  • OpenAPI specs updated (if necessary)

@github-actions github-actions bot added type: tests Testing related pkg: backend Changes in the backend package. pkg: frontend Changes in the frontend package. type: source Changes business logic pkg: mock-ase pkg: mock-account-service-lib labels Oct 22, 2025
@github-actions
Copy link

github-actions bot commented Oct 22, 2025

🚀 Performance Test Results

Test Configuration:

  • VUs: 4
  • Duration: 1m0s

Test Metrics:

  • Requests/s: 44.29
  • Iterations/s: 14.76
  • Failed Requests: 0.00% (0 of 2665)
📜 Logs

> [email protected] run-tests:testenv /home/runner/work/rafiki/rafiki/test/performance
> ./scripts/run-tests.sh -e test "-k" "-q" "--vus" "4" "--duration" "1m"

Cloud Nine GraphQL API is up: http://localhost:3101/graphql
Cloud Nine Wallet Address is up: http://localhost:3100/
Happy Life Bank Address is up: http://localhost:4100/
cloud-nine-wallet-test-backend already set
cloud-nine-wallet-test-auth already set
happy-life-bank-test-backend already set
happy-life-bank-test-auth already set
     data_received..................: 962 kB 16 kB/s
     data_sent......................: 2.0 MB 34 kB/s
     http_req_blocked...............: avg=6.03µs   min=2.15µs   med=5.18µs   max=650.82µs p(90)=6.25µs   p(95)=6.77µs  
     http_req_connecting............: avg=430ns    min=0s       med=0s       max=614.98µs p(90)=0s       p(95)=0s      
     http_req_duration..............: avg=89.67ms  min=7.93ms   med=73.85ms  max=532.26ms p(90)=152.12ms p(95)=172.69ms
       { expected_response:true }...: avg=89.67ms  min=7.93ms   med=73.85ms  max=532.26ms p(90)=152.12ms p(95)=172.69ms
     http_req_failed................: 0.00%  ✓ 0         ✗ 2665
     http_req_receiving.............: avg=84.94µs  min=25.04µs  med=76.56µs  max=1.3ms    p(90)=112.21µs p(95)=139.55µs
     http_req_sending...............: avg=34.29µs  min=10.54µs  med=27.16µs  max=1.59ms   p(90)=40.25µs  p(95)=54.3µs  
     http_req_tls_handshaking.......: avg=0s       min=0s       med=0s       max=0s       p(90)=0s       p(95)=0s      
     http_req_waiting...............: avg=89.55ms  min=7.76ms   med=73.68ms  max=532.2ms  p(90)=152.01ms p(95)=172.59ms
     http_reqs......................: 2665   44.286114/s
     iteration_duration.............: avg=270.72ms min=178.73ms med=256.92ms max=1.04s    p(90)=324.86ms p(95)=359.48ms
     iterations.....................: 888    14.756499/s
     vus............................: 4      min=4       max=4 
     vus_max........................: 4      min=4       max=4 

@oana-lolea oana-lolea requested a review from mkurapov October 22, 2025 08:04
@oana-lolea oana-lolea marked this pull request as ready for review October 22, 2025 08:04
Comment on lines 630 to 636
if (
[IncomingPaymentState.Pending, IncomingPaymentState.Expired].includes(
payment.state
)
) {
return BigInt(0)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should include the received amount regardless of the incoming payment state

return payment
}

async function getPage(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can have the getWalletAddressPage use this function also, just need to add in the wallet address filter in the options

"Specify the sort order of incoming payments based on their creation date, either ascending or descending."
sortOrder: SortOrder
"Filter incoming payments based on specific criteria such as initiation reason."
filter: IncomingPaymentFilter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add this filter to the walletAddress.incomingPayments resolver (since that is the resolver we will be using for the POS service API)

function validateReceiveAmount(
deps: ServiceDependencies,
payment: IncomingPayment,
sentAmount: bigint | undefined
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sentAmount: bigint | undefined
receivedAmount: bigint | undefined

const { sortOrder, filter, ...pagination } = args
const order = sortOrder === 'ASC' ? SortOrder.Asc : SortOrder.Desc
const incomingPayments = await incomingPaymentService.getWalletAddressPage({
const incomingPayments = await incomingPaymentService.getPage({
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used getPage to be able to use the filter

if (walletAddressId) {
query.where('walletAddressId', walletAddressId)
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added client and walletAddressId so that getWalletAddressPage can use getPage

@oana-lolea oana-lolea requested a review from mkurapov October 24, 2025 07:20
Copy link
Contributor

@mkurapov mkurapov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, a few comments

@oana-lolea oana-lolea requested a review from mkurapov October 28, 2025 15:50
Copy link
Contributor

@mkurapov mkurapov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final comment

getPage: (pagination_: Pagination, sortOrder_?: SortOrder) =>
getPageFn(pagination_, sortOrder_),
page: incomingPayments,
sortOrder: order
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to add filter in this as well, otherwise the payment results won't match the page info results

@oana-lolea oana-lolea merged commit 99f64ed into pos-card-services Oct 29, 2025
52 checks passed
@oana-lolea oana-lolea deleted the oana/raf-1165 branch October 29, 2025 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: backend Changes in the backend package. pkg: frontend Changes in the frontend package. pkg: mock-account-service-lib pkg: mock-ase type: source Changes business logic type: tests Testing related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants